{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs/car_map_transform.ipynb', '/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs/navigation_get.py', '/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs/navigation_point.png', '/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs/waypoint.py', '/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs/agents/navigation/controller.py', '/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs/agents/navigation/behavior_types.py', '/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs/agents/navigation/behavior_agent.py', '/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs/agents/navigation/local_planner.py', '/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs/agents/navigation/basic_agent.py', '/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs/agents/navigation/__pycache__/constant_velocity_agent.cpython-38.pyc', '/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs/agents/navigation/__pycache__/__init__.cpython-37.pyc', '/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs/agents/navigation/__pycache__/behavior_agent.cpython-37.pyc', '/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs/agents/navigation/__pycache__/behavior_types.cpython-38.pyc', '/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs/agents/navigation/__pycache__/__init__.cpython-38.pyc', '/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs/agents/navigation/__pycache__/behavior_agent.cpython-38.pyc', '/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs/agents/navigation/__pycache__/controller.cpython-37.pyc', '/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs/agents/navigation/__pycache__/controller.cpython-38.pyc', '/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs/agents/navigation/__pycache__/behavior_types.cpython-37.pyc', '/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs/agents/navigation/__pycache__/local_planner.cpython-37.pyc', '/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs/agents/navigation/__pycache__/global_route_planner.cpython-37.pyc', '/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs/agents/navigation/__pycache__/basic_agent.cpython-37.pyc', '/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs/agents/navigation/__pycache__/global_route_planner.cpython-38.pyc', '/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs/agents/navigation/__pycache__/local_planner.cpython-38.pyc', '/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs/agents/navigation/__pycache__/basic_agent.cpython-38.pyc', '/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs/agents/navigation/global_route_planner.py', '/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs/agents/navigation/constant_velocity_agent.py', '/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs/agents/navigation/__init__.py', '/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs/agents/__pycache__/__init__.cpython-37.pyc', '/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs/agents/__pycache__/__init__.cpython-38.pyc', '/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs/agents/tools/misc.py', '/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs/agents/tools/__pycache__/__init__.cpython-37.pyc', '/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs/agents/tools/__pycache__/misc.cpython-37.pyc', '/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs/agents/tools/__pycache__/misc.cpython-38.pyc', '/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs/agents/tools/__pycache__/__init__.cpython-38.pyc', '/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs/agents/tools/__init__.py', '/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs/agents/__init__.py', '/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs/carla_xml_read.ipynb']\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs/car_map_transform.ipynb\n",
      "41.3310546875MB\n"
     ]
    }
   ],
   "source": [
    "import os\n",
    "\n",
    "allFilePath = []  # 存放所有的文件路径\n",
    "dirSize = 0  # 文件夹大小  单位：字节\n",
    "\n",
    "\n",
    "# 获取文件夹下的所有文件\n",
    "def getAllFilePath(path):\n",
    "    '''\n",
    "    这个思路可以延伸做一个文件查找器：把所有文件、文件夹添加进数组  然后 in 数组 可以反馈搜索结果\n",
    "    '''\n",
    "    # 文件夹结尾判断有没有'/'\n",
    "    if path[-1].__eq__('/'):\n",
    "        pass\n",
    "    else:\n",
    "        path = path + '/'\n",
    "    global allFilePath  # 全局变量\n",
    "    fileList = os.listdir(path)  # 获得文件夹下面的所有内容\n",
    "    for i in fileList:\n",
    "        if os.path.isdir(path + i):  # 如果是文件夹  那就再次调用函数去递归\n",
    "            getAllFilePath(path + i)  # 调用自己\n",
    "        else:\n",
    "            '''\n",
    "            如果你只想获得某类文件  比如'.xml'结尾的文件  可以用正则表达式  demo如下\n",
    "            '.' 匹配除换行符 \\n 之外的任何单字符\n",
    "            '+' 至少出现一次  \n",
    "            '\\.' 转义.  因为.在正则表达式中是关键字  所以需要转义 \n",
    "            '$' 以什么结尾（'^' 以什么开头）\n",
    "            \n",
    "            if re.match('.+\\.xml$', i):\n",
    "                allFilePath.append(path + i)\n",
    "            '''\n",
    "            allFilePath.append(path + i)  # 把文件的名字加入数组\n",
    "\n",
    "\n",
    "# 获取文件夹的大小\n",
    "def getDirSize(path):\n",
    "    # 文件夹结尾判断有没有'/'\n",
    "    if path[-1].__eq__('/'):\n",
    "        pass\n",
    "    else:\n",
    "        path = path + '/'\n",
    "    global dirSize  # 全局变量\n",
    "    fileList = os.listdir(path)  # 获得文件夹下面的所有内容\n",
    "    for i in fileList:\n",
    "        if os.path.isdir(path + i):  # 如果是文件夹  那就再次调用函数去递归\n",
    "            getDirSize(path + i)  # 调用自己\n",
    "        else:\n",
    "            size = os.path.getsize(path + i)  # 获取文件的大小\n",
    "            dirSize = dirSize + size  # 叠加\n",
    "\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    getAllFilePath('/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs')\n",
    "    print(allFilePath)\n",
    "    aww = size = os.path.getsize(allFilePath[0])\n",
    "    print(allFilePath[0])\n",
    "    print(str(aww / 1024) + 'MB')\n",
    "    # getDirSize('/home/autocar/Desktop/data_raid1_md0/GITEE/carla_research/CARLA_lcs')\n",
    "    # print(str(int(dirSize / 1048576)) + ' MB')\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "import tkinter as tk\n",
    "\n",
    "# 创建主窗口\n",
    "root = tk.Tk()\n",
    "root.title(\"Tkinter Hello World\")\n",
    "\n",
    "# 创建一个标签\n",
    "label = tk.Label(root, text=\"Welcome to Tkinter!\")\n",
    "label.pack(pady=10)\n",
    "\n",
    "# 创建一个按钮\n",
    "button = tk.Button(root, text=\"Say Hello\", command=lambda: label.config(text=\"Hello, Tkinter!\"))\n",
    "button.pack(pady=10)\n",
    "\n",
    "# 进入主事件循环\n",
    "root.mainloop()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/README.en.md\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/README.md\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/LICENSE\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/.git/ORIG_HEAD\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/.git/packed-refs\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/.git/index\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/.git/COMMIT_EDITMSG\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/.git/HEAD\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/.git/description\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/.git/FETCH_HEAD\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/.git/config\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/.git/refs/remotes/origin/master\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/.git/refs/remotes/origin/HEAD\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/.git/refs/heads/master\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/.git/objects/9a/daa1619089ca4a62cdc634974003a04f1b60db\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/.git/objects/4c/3a6eaa10335781f6543c9fdbe9b656ee2dc275\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/.git/objects/pack/pack-6fc2e00c75f309f8d0cff03a0f8e331bf8258b82.idx\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/.git/objects/pack/pack-6fc2e00c75f309f8d0cff03a0f8e331bf8258b82.pack\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/.git/objects/d7/d1da0041870284af9d53eaf5fa3007d99c246d\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/.git/objects/36/509d8440ff690fe37a23aac96d6b40a8a5e461\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/.git/hooks/pre-merge-commit.sample\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/.git/hooks/pre-applypatch.sample\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/.git/hooks/commit-msg.sample\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/.git/hooks/update.sample\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/.git/hooks/pre-push.sample\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/.git/hooks/prepare-commit-msg.sample\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/.git/hooks/post-update.sample\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/.git/hooks/pre-receive.sample\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/.git/hooks/applypatch-msg.sample\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/.git/hooks/pre-rebase.sample\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/.git/hooks/pre-commit.sample\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/.git/hooks/fsmonitor-watchman.sample\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/.git/logs/HEAD\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/.git/logs/refs/remotes/origin/master\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/.git/logs/refs/remotes/origin/HEAD\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/.git/logs/refs/heads/master\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/.git/info/exclude\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/test/test.ipynb\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/gitee_easy/t_main.py\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/gitee_easy/test.ipynb\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/gitee_easy/git_check.py\n",
      "/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop/gitee_easy/__pycache__/get_path_now.cpython-312.pyc\n"
     ]
    }
   ],
   "source": [
    "# import os\n",
    "# filePath = '/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop'\n",
    "import os\n",
    "\n",
    "def get_file_names(directory):\n",
    "    file_names = []\n",
    "    for root, dirs, files in os.walk(directory):\n",
    "        for file in files:\n",
    "            file_names.append(os.path.join(root, file))\n",
    "    return file_names\n",
    "\n",
    "directory = '/home/autocar/Desktop/data_raid1_md0/GITEE/gitee_desktop' # 替换为你的目录路径\n",
    "file_names = get_file_names(directory)\n",
    "for i in range(len(file_names)):\n",
    "    print(file_names[i])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [],
   "source": [
    "def op1():\n",
    "    print('hello world!')\n",
    "def op2(entry_line):\n",
    "    print('input infomation:' + entry_line.get())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "input infomation:abcdedd\n",
      "input infomation:abcdedd\n",
      "input infomation:I'm a pig\n"
     ]
    }
   ],
   "source": [
    "import tkinter\n",
    "from tkinter import ttk\n",
    "# 创建窗口\n",
    "window_main = tkinter.Tk()\n",
    "# 添加标题\n",
    "window_main.title(\"Gitee Desktop\")\n",
    "# 设置窗体大小\n",
    "window_main.geometry('640x640')\n",
    "# 创建窗体颜色\n",
    "window_main.configure(background='white')\n",
    "\n",
    "# pull 按钮\n",
    "pull_b_w = 10\n",
    "pull_b_h = 2\n",
    "pull_b_command = op1\n",
    "pull_b_x = 300\n",
    "pull_b_y = 100\n",
    "button_pull = tkinter.Button(window_main, text='Pull code', command=lambda:pull_b_command(), width=pull_b_w, height=pull_b_h)\n",
    "button_pull.place(x=pull_b_x, y=pull_b_y)\n",
    "\n",
    "# commit input\n",
    "commit_w = 40\n",
    "commit_h = 2\n",
    "commit_x = 10\n",
    "commit_y = 400\n",
    "commit_line = tkinter.Entry(window_main, insertbackground='white', width=commit_w)\n",
    "commit_line.place(x=commit_x, y=commit_y)\n",
    "\n",
    "# push 按钮\n",
    "push_b_w = 10\n",
    "push_b_h = 2\n",
    "push_b_command = op2\n",
    "push_b_x = 300\n",
    "push_b_y = 150\n",
    "button_push = tkinter.Button(window_main, text='Push code', command=lambda:push_b_command(commit_line), width=push_b_w, height=push_b_h)\n",
    "button_push.place(x=push_b_x, y=push_b_y)\n",
    "\n",
    "# 创建仓库列表\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "# 开启窗体更新循环\n",
    "window_main.mainloop()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "normal_38",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.20"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
